widget: Queue a draw when we need to
authorMatthias Clasen <mclasen@redhat.com>
Sun, 23 Aug 2020 21:07:37 +0000 (17:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 23 Aug 2020 21:07:37 +0000 (17:07 -0400)
The code in gtk_widget_real_css_changed assumes that
queue_resize > queue_allocate > queue_draw, but the
second one is not really true. These days, we happily
keep reusing the same render node even when the child
allocation is changed.

So, if a css change has flags that tell us we should
redraw, we need to queue a draw, otherwise we might
end up reusing an outdated render node.

This fixes spinners staying visible when they stop
spinning, despite the theme setting their opacity
to 0.

gtk/gtkwidget.c

index 8dfb157e877a823dd7f17ad90f5454674cce738e..9f538f42ead46eed73922bdb7f539d15530be68e 100644 (file)
@@ -4674,8 +4674,9 @@ gtk_widget_real_css_changed (GtkWidget         *widget,
             {
               gtk_widget_queue_allocate (priv->parent);
             }
-          else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW) ||
-                   (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CONTENT)))
+
+          if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW) ||
+              (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CONTENT)))
             {
               gtk_widget_queue_draw (widget);
             }